function traceback()
    local level = 1
    while true do
        local info = debug.getinfo(level, "Sl")
        if not info then break end
        if info.what == "C" then
            print(level .. ".C function")
        else
            print(string.format("%d.[%s]:%d", level, info.short_src, info.currentline))
        end
        level = level + 1
    end
end

function main()
    print("I am the main")
    traceback()
end

print("start...")
main()
print(debug.traceback(main))
print("end...")
